<?php

declare(strict_types=1);

namespace App\Listener\Models;

use App\Model\Goods\Goods;
use Hyperf\Database\Model\Relations\Relation;
use Hyperf\Event\Annotation\Listener;
use Hyperf\Framework\Event\BootApplication;
use Hyperf\Event\Contract\ListenerInterface;

#[Listener]
class MorphMapRelationListener implements ListenerInterface
{
    public function listen(): array
    {
        return [
            BootApplication::class
        ];
    }

    public function process(object $event): void
    {
        Relation::morphMap([
            'goods' => Goods::class
        ]);
    }
}
